function MageG1zStar1()
	local moving = ccrPIM()
	local combat = ccrPIIC()
	local moving, combat, casting = ccrPIM(), ccrPIIC(), ccrPICAOCH()

	_ThrottleFrame()
	-- if isAoE == nil then AoEToggle() end
	
	if combat then pullallunitsm("Living Bomb") end

	if not casting then

		if not ccrPHB(1459) and SIR(1459) then ccrCast(1459, "player") return end -- Arcane Brilliance
		
		if not moving then

			if not ccrPHB(6117) and SIR(6117) then ccrCast(6117, "player") return end -- Mage Armor

			if not combat and GetItemCount(36799, false, true) < 3 and SIR(759) then ccrCast(759) return end -- Mana Gem
		end
	end

	if moving and ccrPHB(110909) then ccrCast(108978) return end -- alter time check later

	if combat then

		local time = GetTime()

		if ThokThrottle and time < ThokThrottle and ccrPICAOCH() then
			if ccrPICA() then
				local _, _, _, _, _, tEnd = UnitCastingInfo("player")
				if tEnd > ThokThrottle then SpellStopCasting() end
			else
				local _, _, _, _, _, tEnd = UnitChannelInfo("player")
				if tEnd > ThokThrottle then SpellStopCasting() end
			end
		end

		if _RuneToggle <= time and not ccrPHB(116014) and not moving and not ccrPICAOCH() then
			ccrCast(116011)
			CastAtLocation(Player:GetLocation())
			_RuneToggle = time+1.5
			return
		end -- Rune if no rune buff and not moving, casting, or channeling
		if _RuneToggle <= time and time - tRuneOfPower > 60-(select(7, GetSpellInfo(116011))/1000) and not moving and not ccrPICAOCH() then
			ccrCast(116011)
			CastAtLocation(Player:GetLocation())
			_RuneToggle = time+1.5
			return
		end -- Rune if remaining < cast time
		if _RuneToggle <= time and SpellCDDuration(12042) < 1.5/(1+UnitSpellHaste("player")/100) and time - tRuneOfPower > 30 then
			ccrCast(116011)
			CastAtLocation(Player:GetLocation())
			_RuneToggle = time+1.5
			return
		end -- Rune if Arcane Power CD is less than GCD and remaining time < 30

		local altertime = ccrPHB(110909)
		local fourcharge = ccrPHDBS(36032, 4)

		if ccrTargetIsBoss() then

			if SIR(55342) and useCDS then ccrCast(55342) return end -- mirror image
			if SIR(12042) and useCDS and not moving and fourcharge then ccrCast(12042) return end -- arcane power if not moving and max arcane charges
			if _PBI then
				if SIR(108978) and useCDS and not altertime and ccrPHB(12042) and time - _PBI < 100 then
					if ccrPlayerHasGlyph("Glyph of Loose Mana") and ccrPM() < 90 and fourcharge then UseItemByName("Mana Gem") end
					if ccrPlayerHasGlyph("Glyph of Loose Mana") and ccrPM() < 80 then UseItemByName("Mana Gem") end
					-- Jade Serpent Potion sync with Alter Time need to implement
					ccrCast(108978)
				end
			end -- Alter Time
		end

		if ccrValidTarget() then

			-- if SIR(2120) and ccrTargetCount(8) > 5 then
			-- 	ccrCast(2120)
			-- 	CastAtLocation(Target:GetLocation())
			-- 	return
			-- end -- flamestrike
			local barrage = SCA(44425)

			if barrage and ccRS.Manual_AoE and fourcharge and ccrTargetCount(8) > 4 then ccrCastAttack(44425) return end -- arcane barrage AoE
			if barrage and altertime and not ccrPHBR(110909, select(7, GetSpellInfo(30451))/1000) then ccrCastAttack(44425) return end -- arcane barrage alter time dump if can't arcane blast
			local missiles = SCA(5143)
			if missiles and altertime then ccrCastAttack(5143) return end -- arcane missiles alter time dump
			if barrage and altertime then ccrCastAttack(44425) return end -- arcane barrage alter time dump
			if SIR(44457) and ccrInRange(125430, "target") and #tLivingBomb < 3 and --[[isAoE == 0 and]] not ccrTargetHasDebuff(44457) then ccrCastAttack(44457) return end -- living bomb target
			if SIR(44457) and ccRS.Manual_AoE and #tLivingBomb < 3 and #tNoObjectLivingBomb > 0 and not ccrPICAOCH() then rawget(tNoObjectLivingBomb, 1):CastSpellByName("Living Bomb") return end -- living bomb cycle
			if SIR(1449) and ccRS.Manual_AoE and ccrPlayerCount(15) > 5 then ccrCast(1449) return end -- arcane explosion aoe
			local blast = SCA(30451)
			if blast and TierBonusChecker() >= 2 and ccrPHB(79683) and not ccrPHBS(79683, 2) and fourcharge and ccrPHBS(145252, 2) and ccrPM() > 90 then ccrCastAttack(30451) return end -- arcane blast spam
			if blast and TierBonusChecker() >= 2 and ccrPHB(79683) and not ccrPHBS(79683, 2) and fourcharge and ccrPHB(145252) and ccrPM() > 93 then ccrCastAttack(30451) return end -- arcane blast spam
			if missiles and ccrPHBS(79683, 2) and (SpellCDDuration(12042) > (1.5/(1+UnitSpellHaste("player")/100)) or (fourcharge and SpellCDDuration(12042) > 6*(2/(1+UnitSpellHaste("player")/100)))) then ccrCastAttack(5143) return end -- arcane missiles
			if barrage and fourcharge and ccrPM() < 95 then ccrCastAttack(44425) return end -- arcane barrage mana conserve
			if blast and not moving then ccrCastAttack(30451) return end -- arcane blast
			if moving and barrage then ccrCastAttack(44425) return end -- arcane barrage moving
			if moving and SCA(2136) then ccrCastAttack(2136) return end -- fire blast moving
			if moving and SCA(30455) then ccrCastAttack(30455) return end -- ice lance moving
		end
	end
end

function MageG1zStar3()

	_ThrottleFrame()
	-- if isAoE == nil then AoEToggle() end

	if ccrPIIC() then pullallunitsm("Living Bomb") end
	
	if not ccrPHB(1459) then ccrCast(1459, "player") return end -- Arcane Brilliance
	if not ccrPHB(7302) then ccrCast(7302, "player") return end -- Frost Armor
	if PlayerHasPet() == false and SIR(31687) then ccrCast(31687) return end -- water elemental
	
	if ccrPIM() and ccrPHB(110909) then ccrCast(108978) return end -- alter time check later
	
	if ccrPIIC() then

		if ThokThrottle and GetTime() < ThokThrottle and ccrPICAOCH() then
			if ccrPICA() then
				local _, _, _, _, _, tEnd = UnitCastingInfo("player")
				if tEnd > ThokThrottle then SpellStopCasting() end
			else
				local _, _, _, _, _, tEnd = UnitChannelInfo("player")
				if tEnd > ThokThrottle then SpellStopCasting() end
			end
		end

		if _RuneToggle <= GetTime() and not ccrPHB(116014) and not ccrPIM() and not ccrPICAOCH() then
			ccrCast(116011)
			CastAtLocation(Player:GetLocation())
			_RuneToggle = GetTime()+1.5
			return
		end
		if _RuneToggle <= GetTime() and GetTime() - tRuneOfPower > 58.5 and not ccrPHB(110909) and not ccrPICAOCH() and not ccrPIM() then
			ccrCast(116011)
			CastAtLocation(Player:GetLocation())
			_RuneToggle = GetTime()+1.5
			return
		end
		if useCDS and SIR(12472) and (GetTime() - tRuneOfPower) > 40 and _RuneToggle <= GetTime() and not ccrPICAOCH() and not ccrPIM() then
			ccrCast(116011)
			CastAtLocation(Player:GetLocation())
			_RuneToggle = GetTime()+1.5
			return
		end
		if ccrTargetIsBoss() then
			if SIR(55342) and useCDS then ccrCast(55342) return end
		end
		if ccrValidTarget() then
			if SCA(84714) then ccrCastAttack(84714) return end
		end
		if ccrTargetIsBoss() then
			if SIR(12472) and useCDS and not ccrPIM() and (ccrPHB(57761) or ccrPHB(44544)) then ccrCast(12472) return end
			if SIR(108978) and useCDS and not ccrPHB(110909) and ccrPHB(12472) then ccrCast(108978) return end
			if SCA(44614) and ccrPHB(110909) and ccrPHB(57761) then ccrCastAttack(44614) return end
			if SCA(30455) and ccrPHB(110909) and ccrPHB(44544) then ccrCastAttack(30455) return end
			if SIR(44457) and ccrInRange(125430, "target") and #tLivingBomb < 3 and --[[isAoE == 0 and]] not ccrTargetHasDebuff(44457) then ccrCastAttack(44457) return end
			if SIR(44457) and ccRS.Manual_AoE and #tLivingBomb < 3 and #tNoObjectLivingBomb > 0 then rawget(tNoObjectLivingBomb, 1):CastSpellByName("Living Bomb") return end
			if SCA(44614) and ccrPHB(57761) and (SpellCDDuration(12472) > 2 or not useCDS) then ccrCastAttack(44614) return end
			if SCA(30455) and ccrPHB(146557) and ccrPHB(44544) then ccrCastAttack(30455) return end
			if SCA(30455) and ccrPHB(44544) and (ccrPHBR(44544, 2) or (ccrPHBS(44544, 2) and (SpellCDDuration(12472) > 2 or not useCDS))) then ccrCastAttack(30455) return end
			if SCA(116) and not ccrPlayerIsMoving() then ccrCastAttack(116) return end
			if SCA(30455) and ccrPlayerIsMoving() then ccrCastAttack(30455) return end
		end
		if not ccrTargetIsBoss() then
			if SCA(44614) and ccrPHB(110909) and ccrPHB(57761) then ccrCastAttack(44614) return end
			if SCA(30455) and ccrPHB(110909) and ccrPHB(44544) then ccrCastAttack(30455) return end
			if SIR(44457) and ccrInRange(125430, "target") and #tLivingBomb < 3 and --[[isAoE == 0 and]] not ccrTargetHasDebuff(44457) then ccrCastAttack(44457) return end
			if SIR(44457) and ccRS.Manual_AoE and #tLivingBomb < 3 and #tNoObjectLivingBomb > 0 then rawget(tNoObjectLivingBomb, 1):CastSpellByName("Living Bomb") return end
			if SCA(44614) and ccrPHB(57761) then ccrCastAttack(44614) return end
			if SCA(30455) and ccrPHB(146557) and ccrPHB(44544) then ccrCastAttack(30455) return end
			if SCA(30455) and ccrPHB(44544) and (ccrPHBR(44544, 2) or ccrPHBS(44544, 2)) then ccrCastAttack(30455) return end
			if SCA(116) and not ccrPlayerIsMoving() then ccrCastAttack(116) return end
			if SCA(30455) and ccrPlayerIsMoving() then ccrCastAttack(30455) return end
		end
	end
end